package ru.jexp.rcp.supply.beans.zs.wizard;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;

import ru.jexp.rcp.supply.beans.zs.JExpWizardPageControlListener;

public abstract class NewWizardPage extends WizardPage
{
	protected abstract void createWizardPage(Composite parent);

	private JExpWizardPageControlListener wizardListener;
	
	public NewWizardPage(String pageName)
	{
		super(pageName);
	}
	
	@Override
	public void createControl(Composite parent)
	{
		createWizardPage(parent);
		postCreateWizard();
	}

	public void postCreateWizard()
	{
		fireOnCreateLiatener();
	}
	
	public void preShowWizard()
	{
		fireOnShowListener();
	}
	
	public void setWizardPageControlListener(JExpWizardPageControlListener wizardListener)
	{
		this.wizardListener = wizardListener;
	}
	
	protected void fireOnCreateLiatener()
	{
		if (wizardListener != null)
		{
			wizardListener.onCreate();
		}
	}
	
	protected void fireOnShowListener()
	{
		if (wizardListener != null)
		{
			wizardListener.onShow();
		}
	}

}
